﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace linkouqs.Gamekit {
    public class CharacterManager : MonoSingleton<CharacterManager> {
        Dictionary<Collider2D, CharacterController2D> m_Characters = new Dictionary<Collider2D, CharacterController2D>();

        public void RegistCharacter(CharacterController2D character) {
            m_Characters.Add(character.BoxCollider2D, character);
        }

        public bool TryGetCharacter(Collider2D collider2D, out CharacterController2D characterController2D) {
            return m_Characters.TryGetValue(collider2D, out characterController2D);
        }

        protected override void OnDestroy() {
            m_Characters.Clear();

            base.OnDestroy();
        }

    }

}
